﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using JulMar.Windows.Mvvm;

namespace NathansMapInfoProjects.WindowManager.ViewModels
{
    /// <summary>
    /// View model for the settings view.
    /// </summary>
    /// <remarks>This view model is really badly designed, it reaches into the Entry point which is bad for
    /// coupling.  This needs to be refactored.</remarks>
    public class SettingsViewModel : SimpleViewModel
    {
        private readonly Settings loadedsettings;

        public SettingsViewModel(Settings loadedsettings)
        {
            this.loadedsettings = loadedsettings;
        }

        public bool AutoLoad
        {
            get { return Entry.settings.AutoLoad; }
            set 
            {
                this.loadedsettings.AutoLoad = value;
                base.OnPropertyChanged("AutoLoad");
                Settings.SaveSettings(this.loadedsettings, this.loadedsettings.LoadedFrom);
            }
        }

        public string LoadedPath
        {
            get
            {
                return "Settings loaded from " + this.loadedsettings.LoadedFrom;    
            }
        }

    }
}
